home *** CD-ROM | disk | FTP | other *** search
/ Die Ultimative Software-P…i Collection 1996 & 1997 / Die Ultimative Software-Pakete CD-ROM fur Atari Collection 1996 & 1997.iso / i / internet / software / dlinksr / lancexb.s < prev    next >
Encoding:
Text File  |  1993-09-21  |  2.8 KB  |  154 lines

  1. ;/********************************************************************/
  2. ;/*                                                                    */
  3. ;/*    Packet driver for D-LINK ethernet controller                    */
  4. ;/*                                                                    */
  5. ;/*    Copyleft by P. Mayer, 1992 TU-Vienna IAEE                        */
  6. ;/*    All rights reserved                                                */
  7. ;/*                                                                    */
  8. ;/********************************************************************/
  9.  
  10.  
  11.     .text
  12.     .super
  13.     
  14.     export    dlink_interrupt
  15.     export    dlink_interrupt
  16.     export    nic_install
  17.     export    vbl_loop
  18.     export    old_intr
  19.     export  clock
  20.     export  dclock
  21.     export  enablirq
  22.     export  disablirq
  23.     export  quitirq
  24.     export    fastread
  25.     export    nic_locked
  26.         
  27.     import    ihandler
  28.     import    rcv_pkt
  29.     import    rcv_check
  30.  
  31. MFP_FLANK    equ $fffa03
  32. MFP_IENB    equ $fffa09
  33. MFP_ISRB    equ $fffa11
  34. MFP_IMASKB    equ $fffa15
  35.  
  36. IRQ_LAT        equ    100
  37.  
  38. *note: for IRQs set assembler option IRQVERSION=1
  39.  
  40. enablirq:
  41.         if    IRQVERSION
  42.          bset    #0,MFP_IMASKB
  43.          bset    #0,MFP_IENB
  44.         endif
  45.         rts
  46.  
  47. nic_install:
  48.         if    IRQVERSION
  49.           bclr    #0,MFP_IENB
  50.          bclr    #0,MFP_IMASKB
  51.          bset    #0,MFP_FLANK    * low to high edge
  52.         endif
  53.         rts
  54.  
  55. disablirq:
  56.         if    IRQVERSION
  57.          bclr    #0,MFP_IMASKB
  58.         endif
  59.         rts
  60.         
  61.         dc.l        'XBRADLNK'
  62. old_intr:    dc.l    0
  63.  
  64. dlink_interrupt:
  65.         bclr    #0,MFP_ISRB        * ack this irq
  66.         move.l    $4ba,lastirq
  67.         tst.b    nic_locked
  68.         bne        exirq
  69.  
  70.         bset    #7,nic_locked
  71.         bclr    #0,MFP_IMASKB    * disable this irq
  72.         tst.l    old_stack
  73.         beq     okstack
  74.         jmp        $1                * error catch
  75. okstack:
  76.         move    (a7),status
  77.         move.l    a7,old_stack
  78.         lea        new_stack,a7
  79.         movem.l    d0-a6,-(a7)
  80.         move    status,d0        * restore imask before irq
  81.         or        #$2000,d0        * stay in supervisor mode
  82.         move    d0,sr
  83.         move.l    ihandler,d0        * other irqs possible
  84.         beq        nohandler
  85.         move.l    d0,a0
  86.         jsr        (a0)
  87. nohandler:
  88.         movem.l    (a7)+,d0-a6
  89.         movea.l    old_stack,a7
  90.         clr.l    old_stack
  91.         bclr    #7,nic_locked
  92.         bset    #0,MFP_IMASKB
  93. exirq:
  94.         rte
  95.         
  96. vbl_loop:
  97.         tst.b    nic_locked
  98.         bne        exloop
  99.         if    IRQVERSION
  100.          move.l    $4ba,d0
  101.          move.l    lastirq,d1
  102.          add.l    #IRQ_LAT,d1
  103.          cmp.l    d1,d0
  104.          bmi        exloop
  105.          move.l    d0,lastirq
  106.         endif
  107.         bset    #7,nic_locked
  108.         if    IRQVERSION
  109.          jsr    disablirq
  110.         endif
  111.         jsr        rcv_check
  112.         if    IRQVERSION
  113.          jsr     enablirq
  114.         endif
  115.         bclr    #7,nic_locked
  116. exloop:
  117.         rts
  118.  
  119. fastread:
  120. fastloop:
  121.         move.b    2(a2),d4
  122.         or.b    d3,d4
  123.         move.b    $12(a2),d3
  124.         lsr.b    #4,d3
  125.         move.b    d4,(a0)+
  126.         dbra    d0,fastloop
  127.         rts                
  128.         
  129. clock:      move.l $4ba,d0                ; 
  130.             rts
  131.  
  132. dclock:     move.l $4ba,d0                ; 
  133.             asl.l    #8,d0
  134.             move.b    $fffa23,d0
  135.             neg.b    d0
  136.             rts
  137.  
  138. savepc:        dc.l 0
  139. savesr:        dc.l 0
  140. lastirq:    dc.l 0
  141. nic_locked:    dc.w 0
  142.  
  143.     .bss
  144.     .even
  145.  
  146. status:        ds.w    1
  147. old_stack:    
  148. OLD_STACK:    ds.l    1
  149.  
  150.             DS.W    512
  151. new_stack:            
  152. NEW_STACK:
  153.             DS.W    10
  154.